package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func main() {

	engine := gin.Default()

	engine.Handle("POST","/login", func(context *gin.Context) {
		path := context.FullPath()
		fmt.Println(path)

		//username := context.PostForm("username")
		//password := context.PostForm("password")
		//fmt.Println(username)
		//fmt.Println(password)

		username, exist := context.GetPostForm("username")
		if exist{
			fmt.Println(username)
		}

		password,exist := context.GetPostForm("password")
		if exist{
			fmt.Println(password)
		}

		context.Writer.Write([]byte(username + "登录"))
	})

	engine.DELETE("/user/:id", func(context *gin.Context) {
		userID := context.Param("id")
		fmt.Println(userID)
		context.Writer.Write([]byte("delete 用户ID:" + userID))
	})

	engine.Run()
}
